package com.ttbj.rule.service.impl;

import com.ttbj.product.bean.dto.CargoDto;
import com.ttbj.rule.po.CarriageRule;
import com.ttbj.rule.service.BillStrategy;

/**
 * 重量计费
 * 
 * @author Medivh
 * @date 2018年6月7日 上午10:24:36
 */
public class BillWeightStrategy implements BillStrategy {
	@Override
	public Float strategyInterface(Float distance,CargoDto cargo, CarriageRule bill) {
		Float unitPrice = bill.getBillWeightPrice();
		Float cargoWeight = cargo.getCargoWeight();
		cargoWeight = cargoWeight == null || cargoWeight <=0.01f ? 0.01f : cargoWeight;
		return unitPrice == null  ? 0 : unitPrice * cargoWeight;
	}
}
